home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: MegaDisc / MegaDisc 45 (1996-03)(MegaDisc Digital Publishing)(AU)(Disk 1 of 2)[WB].zip / MegaDisc 45 (1996-03)(MegaDisc Digital Publishing)(AU)(Disk 1 of 2)[WB].adf / arexx / Manager.txt < prev    next >
Text File  |  1996-02-12  |  22KB  |  460 lines

  1.  
  2.   
  3.                                                   
  4.                           "Manager"               
  5.                                                   
  6.                 My very own All-Purpose Utility   
  7.                                                   
  8.     
  9.                       by John Collett
  10.  
  11.     
  12.        This is an extension to an article called 'Two ARexx Extensions',
  13.        in which I described 'ZedREXX' and 'varexx', in favour of the latter.
  14.            
  15.        Varexx is 'A GUI system for Arexx'.  It is available from aminet/
  16.        utils/arexx.  Its author is Andrew Cook, and I hope he won't mind
  17.        me telling you that he can be contacted at : amc93el@soton.ac.uk
  18.  
  19.        Here I discuss in some detail my main use of 'varexx'.
  20.     
  21.                     -------------------
  22.          
  23.     Those of you who are dedicated users of Dir_this, Dir__that, or
  24.     Dir_the_other will not be persuaded to change your ways by what
  25.     follows, but those who, like me, love tinkering with ARexx, and who
  26.     gain some kind of pleasure from designing and using their own tools,
  27.     may find it a rewarding topic.  It is no exaggeration to say that the
  28.     subject of this article is the most useful day-to-day general purpose
  29.     tool I have ever had.  I've called it 'Manager' - not very original,
  30.     but a good indication of how I perceive the program.  The real satis-
  31.     faction derives from the fact that I did it all myself (with a
  32.     little help from my friends), and I can change it at any time and in
  33.     any way I wish.
  34.  
  35.     To move on into the topic, here are brief lists of most of the tools,
  36.     utilities, etc. which I use with varying frequency.
  37.  
  38.      Day-to-day needs 
  39.         
  40.     There are main-line tools regularly in use such as :
  41.     
  42.      - A CLI of some sort. I use King-Con.
  43.      - A text editor. I'm still using QED.
  44.      - Programs for access to e-mail and internet.
  45.      - My own daily diary reminder called 'Remind'.  Old readers may
  46.        remember that its features include prodding my memory about
  47.        today and tomorrow, but doing it only once a day.
  48.      - A traditional 'dir'-type tool.  My favorite is still the small,
  49.        quick and easy Browser.  I hope that in time Manager may take
  50.        over at least some of its functions.
  51.     
  52.     Then there are the tools which I need only from time to time :
  53.     
  54.      - DPaintIII
  55.      - DosMan, for looking up those AmigaDOS details I can never remember.
  56.      - Findit (a recent internet discovery, handy for locating a file
  57.        you know you've got but you can't remember where it is).
  58.      - Palette, and a useful partner, SCR (Screen Color Requester).
  59.      - Measure, useful for detailed work in planning a graphics layout.
  60.      - SuperDashBoard, for a quick overview of what's happening behind
  61.        the scenes.
  62.          
  63.     And of course Time, Date, Calculator, IconEdit ...... and there are
  64.     undoubtedly others that you would include in your own list.
  65.  
  66.     
  67.      Needs determined by current activities 
  68.     
  69.     I usually have one or more pieces of text in hand. Typically they
  70.     might be :
  71.     
  72.      - An article I'm in the process of writing (like this one).
  73.      - A letter I've started (I'm usually in the middle of one to Peter
  74.        Bagnato).
  75.      - Coding for an ARexx program I'm trying to write.
  76.      - The 'datefile' file for entries I need reminding about.
  77.         
  78.     I need not only to be able to launch my editor quickly, but to have
  79.     it automatically load one or other of these current texts.
  80.     
  81.     If that text happens to be intended for MegaDisc, then I like to have
  82.     a quick way of checking that it will look right when viewed through a
  83.     text presenter with ANSI capabilities such as FullView (though in
  84.     fact I use MultiView for these rehearsals).
  85.     
  86.     If the text is program code, then from time to time I want to be able
  87.     to run it instantly, as easily as possible.
  88.     
  89.  
  90.      Specific needs for 'Manager' development and maintenance 
  91.  
  92.     As described below, I need occasionally to be able to run GadToolsBox
  93.     to edit Manager's window.
  94.  
  95.     The copy of Manager used for updating, trials, and general
  96.     development is held in Work:, but I also have a copy in WBStartup,
  97.     so that it runs automatically at bootup.  So I need an easy way of
  98.     updating the WBStartup version if changes I have just made are to
  99.     apply at my next bootup time.
  100.     
  101.      
  102.      Access to background materials 
  103.     
  104.     As well as quick access to current texts or programs, I may need to
  105.     look up earlier documentation, run some other program, or view an
  106.     image I have stored somewhere.  Ideally, I want to be able to go
  107.     directly to a particular directory, so that I can then read any text,
  108.     view any picture, or run any program, with a minimum of trouble.
  109.  
  110.     
  111.      Organisation of study materials 
  112.     
  113.     Sometimes (quite often), for the good of my soul, or because I need
  114.     it for current computer activities, I have to bite the bullet and
  115.     settle down to some real learning.   Recently, for example, I have
  116.     been probing RexxReqTools, and learning to use a fairly complex image
  117.     processor.
  118.  
  119.     I thought that if I made access to such tasks very easy, then I would
  120.     be less likely to procrastinate.  And I was right.
  121.  
  122.    
  123.      What "Manager" provides 
  124.     
  125.     I'm sorry if the above list of needs and activites seemed to go on
  126.     for ever.  It was just that I wanted to lay a firm foundation for the
  127.     following punch-line :
  128.  
  129.               When "Manager" is running, everything listed
  130.               above can be reached by a single button click.
  131.          
  132.     Its convenience is of course its main feature, but it is not unique
  133.     in such a provision.  I have achieved similar results (though perhaps
  134.     not so extensive) using AutoCLI (with support scripts AutoCLI.f1 to
  135.     .f9, and .e1 to .e9) and ToolManager.  Respectively they require two
  136.     key presses and a menu selection.  In a trivial sense, a single mouse
  137.     click may be easier than either of these, but some people prefer to
  138.     just point and click whenever possible anyway, and I am one of them.
  139.  
  140.     But there is a major difference between 'Manager' and the other two
  141.     systems just mentioned which makes it my clear favourite.
  142.     
  143.               'Manager' offers a window which acts as a
  144.               strategic organiser and a permanent prompt.
  145.     
  146.     It may not be a work of art, but it nicely iconifies my computing
  147.     activities, and offers a rare combination of compactness,
  148.     flexibility, and personalised interface.
  149.  
  150.     'Manager' is run at bootup, and I have available, immediately and
  151.     permanently, a layout of various gadgets.  The critical details -
  152.     what types of gadgets they are, exactly where they are, and what they
  153.     do when selected - are my own choice.  Each gadget has been added to
  154.     the set when I felt the need to include it, and the type, position,
  155.     or task of any gadget can be changed at any time.  It's great.
  156.  
  157.     Doesn't it ever get in the way?
  158.     No, but if you do want to clear the space, there is a zoom gadget
  159.     which reduces the window to an icon into the title bar, though I
  160.     rarely feel the need to use this.  This feature can also be invoked
  161.     from within a script with the command 'window ZIP'.
  162.  
  163.    
  164.        How it works in general 
  165.     
  166.     Gui files are created by using GadToolsBox, and saved.  The
  167.     gadgets which can be inserted into such files include the following
  168.     types, all of which are now supported by varexx :
  169.     
  170.    GETFILE   To enable the user to select a file/dir/volume name.
  171.    BUTTON    To trigger a program action.
  172.    CHECKBOX  To switch program options on or off.
  173.    INTEGER   To obtain numeric values from the user.
  174.    LISTVIEW  To display a list of textual names.
  175.    MX        To let the user select one out of several possibilities
  176.              (I thought these were usually called 'radio buttons').
  177.    NUMBER    A read-only gadget to display a numerical value.
  178.    CYCLE     To let the user select one out of several possibilities.
  179.    PALETTE   To let the user select a colour from a set palette.
  180.    SCROLLER  To adjust the positions of a view, for example
  181.              scrolling the text up and down in a text editor.
  182.    SLIDER    To select a value within a fixed range, for instance
  183.              the red, green and blue intensities of a palette editor.
  184.    STRING    Normally used to obtain character strings from the user.
  185.    TEXT      A read only gadget to display a character string.
  186.  
  187.     The GadToolsBox program includes heaps of further options via its
  188.     menus, but few of them are currently relevant to varexx.
  189.  
  190.     When each gadget is created, its type, position, and wording (if any)
  191.     are determined.  If it is going to have a job to do, it must be
  192.     assigned a unique label.  Only then can its selection be recognised
  193.     in any ARexx program which loads in this particular gui file.
  194.  
  195.     
  196.       How it works in a particular case 
  197.  
  198.      Consider this hypothetical sequence :
  199.     
  200.      - GadToolsBox opens, and displays a gui window ready for use as a
  201.        template.
  202.      - By menu selection, a gadget is inserted in the window.
  203.                __________________________________ 
  204.               |__|_________________________|__|__|
  205.               |                                  |
  206.               |    __________________            |
  207.               |   |                  |           |
  208.               |   |   Sample gadget  |           |
  209.               |   |__________________|           |
  210.               |                                  |
  211.               |__________________________________|
  212.     
  213.      - A label, say, SAMPGAD, is assigned to the gadget.
  214.      - You make the window whatever size you want it to be, place it
  215.        as required, and you can arrange for it to have whatever system
  216.        gadgets etc. you choose.
  217.      - The gui is saved.
  218.     
  219.     Later, assuming 'varexx' is launched (in the same way as 'rexxmast'
  220.     must be used before running an ARexx program) :
  221.  
  222.      - An ARexx program loads in and displays the gui.
  223.      - A user clicks on the sample gadget.
  224.      - The message SAMPGAD is received by the program.
  225.      - Further coding determines subsequent actions.
  226.     
  227.     In this way, I have developed a window with all the gadgets I need.
  228.     The coding which they invoke in my program does its job, and I have
  229.     ended up with a pretty useful "All-Purpose Utility".
  230.  
  231.     
  232.       How "Manager" works in each session 
  233.  
  234.     My 'startup-sequence' file has long included 'rexxmast'.  Just after
  235.     that line I have now inserted 'varexx rexx:gui'. So both ARexx and
  236.     varexx are available in the background, and varexx will use the
  237.     'rexx:gui' directory as its default source for all gui files.
  238.  
  239.     A copy of the "Manager" program itself (with DONOTWAIT as one of its
  240.     tool settings) is in the WBStartup directory.  It therefore runs
  241.     automatically at bootup, and is always available.   On my first
  242.     access each day, if I have any social engagements today or tomorrow,
  243.     I am reminded of them.
  244.     
  245.     It's a relatively new toy, and so I change the window frequently, but
  246.     at the moment it appears at position 160,60, is 350 pixels across by
  247.     80, and contains 24 gadgets and a List.
  248.  
  249.        
  250.       How I make changes 
  251.     
  252.     If, for example, I decided that I want to see the date at the beginning
  253.     of every session, how would I go about it?  I could simply click
  254.     on the 'Date' gadget which is already in the window, but let's say I
  255.     want it to be displayed automatically.
  256.  
  257.     I already know that I am going to keep on changing the contents of my
  258.     Manager window, so one of my Manager's button gadgets is designed to
  259.     launch GadToolsBox. Then the dialogue in GadToolsBox goes like this :
  260.     
  261.         Open
  262.           Volumes
  263.             Rexx:
  264.               gui/
  265.                 manager.gui
  266.         
  267.         Menu #2 Gadgets
  268.           Kind
  269.             Text
  270.         Click and drag, to place and size the new gadget.
  271.         
  272.         Text gadget editor :
  273.           Text    (leave empty; the date will be inserted there later)
  274.           Label   TODAYDATE ('DATE' has already been used)
  275.           Others  ignore
  276.        
  277.         Save and Quit
  278.     
  279.     Now I have to tell 'Manager' what to do with it. One click opens my
  280.     text editor and loads 'manager.rexx'. (Oh, the convenience.)
  281.  
  282.     The date-display gadget is not intended to be clicked, but just to
  283.     display the date. We don't require it to send a message, so there is
  284.     no need to include a 'when class = TODAYDATE' handler.  We simply
  285.     want to set the text displayed in the new gadget to today's date as
  286.     soon as the window is opened.
  287.  
  288.     All it needs is a brief insertion after 'show' :
  289.  
  290.       show                        /* Displays the window */
  291.       'settext TODAYDATE 'date()  /* Inserts today's date
  292.                                      in the gadget labelled TODAYDATE */
  293.     
  294.     (By the way, it's worth mentioning here that some of the 'set'
  295.     commands have to be given before the window is diplayed by
  296.     the 'show' command. 'Settext' is not one of them.)
  297.   
  298.     Let's now stay with this idea, just to indicate the direction to be
  299.     taken if something less trivial is to be inserted - though the
  300.     example I'm using is actually a silly one.
  301.     
  302.     If instead of selecting Menu_2/Kind/Text we go for Menu_2/Kind/String,
  303.     we make a gadget the contents of which can be changed by a user.
  304.     Just to demonstrate how it works, we'll have the date displayed as
  305.     before, and then shout at a user who tries to change it.  We'll give
  306.     this gadget the label DATESTRING.  The line  'settext DATESTRING
  307.     'date() will have the same effect as  'settext TODAYDATE 'date(),
  308.     but it will be able to detect and respond to user input.  On any such
  309.     input, the message sent to the program will be DATESTRING and the
  310.     output from date(), so some parsing is necessary using word().  The
  311.     coding looks like this :
  312.  
  313.          when word(class,1) = 'DATESTRING' then do 
  314.            msg = "You fool!  Stop trying to change today's date." ,
  315.                  '0a'x || "Such things are beyond human control."
  316.            call message (msg)
  317.            end
  318.  
  319.     In its turn the message procedure uses the RexxReqTools rtezrequest()
  320.     function :
  321.  
  322.       message : procedure
  323.       call rtezrequest( arg(1),'Okay','A Message',,
  324.        'rt_reqpos = reqpos_topleftscr rtez_flags=ezreqf_centertext',)
  325.       return
  326.  
  327.      If you tried to change the contents of this gadget, you would  see :
  328.                  _________________________________________________ 
  329.                 | A Message ___________________________________|__|
  330.                 | _______________________________________________ |
  331.                 || You fool! Stop trying to change today's date. ||
  332.                 ||     Such things are beyond human control.     ||
  333.                 ||_______________________________________________||
  334.                 |                   | Okay |                      |
  335.                 |_________________________________________________|
  336.                 
  337.  
  338.     So that's how gadgets are added, and how they can determine
  339.     subsequent actions.  Immediately after such editing, I want to quit
  340.     and restart Manager to see the effects of any changes.  Easy.  As
  341.     well as 'Manager.rexx' in my Work: directory, and a copy in
  342.     WBStartup, I also have a 'Manager' icon 'left out' on my Workbench
  343.     screen, so restarting it is just a matter of a couple of clicks.
  344.  
  345.     
  346.      Examples of gadget planning strategies 
  347.     
  348.     I mentioned above the need for quick access to background materials
  349.     - document, picture, and program collections.  Here I'll discuss
  350.     briefly some good and some not so good ways in which this could be
  351.     approached.  They serve as illustrations of some of the types of
  352.     gadgets available (though I cannot reproduce the graphics elements
  353.     here).
  354.  
  355.      1   Three file-selector gadgets
  356.                      __
  357.              Texts  |  |          In each box there is
  358.                     |__|          a file selector symbol
  359.              Pix    |  |          which I have given up
  360.                     |__|          trying to reproduce here.
  361.              Progs  |  |
  362.                     |__|
  363.     
  364.     They work perfectly; clicking on any one takes you straight to a
  365.     target directory.
  366.  
  367.      2   An MX (radio button) gadget
  368.                                             _
  369.              _                             (*)
  370.      Texts  (*)                     Texts  (_)
  371.      Pix    (_)                     Pix    (_)
  372.      Progs  (_)                     Progs  (_)
  373.  
  374.     Coding handles the outcome of actions, and clicking on a button opens
  375.     a file requester as required. I have tried the arrangement on the
  376.     left, but met the problem that one of the choices must always be
  377.     'on'. It worked better with a dummy ('None of these') button as shown
  378.     here on the right.  Program coding resets the flag to the dummy after
  379.     any of the real ones have been used.  It works, but this type of
  380.     gadget is not the best for this particular job.
  381.  
  382.      3   A CYCLE gadget
  383.     
  384.     As you click it, it displays
  385.           ___________          __________          __________ 
  386.          |@|Read text|   or   |@|Show pic|   or   |@|Run prog|
  387.     
  388.     where '@' stands for the circular arrow thingy.  When it matches your
  389.                                               __ 
  390.     intention, you click on an accompanying  [Ok].
  391.     It does work, and is economical on space, but is not particularly
  392.     elegant for this specific task.
  393.  
  394.      4   A List gadget
  395.     
  396.     The list gadget turns out to be one of the most interesting features.
  397.     List items can of course be selected by a user.  That's why they're
  398.     there.
  399.  
  400.     But items can also be added, cleared, selected, etc. from within the
  401.     ARexx program itself, which makes it a powerful way of changing the
  402.     available range of options while a program is running.
  403.     
  404.     One aspect of this is particularly interesting. If you create even
  405.     just a token and initially empty list gadget for your varexx window
  406.     via GadToolsBox, you can then add as many items to it as you like.
  407.     The actions subsequent upon their selection can be determined by
  408.     coding, and thus a large range of options can be made available
  409.     without having to run GadToolsBox again (not that that in itself is
  410.     any problem, of course).
  411.     
  412.     The appearance of lists can thus change radically :
  413.  
  414.       ______________       _______________        ______________ 
  415.      |Read Text   | |     | Monday      | |      |Editor      | |
  416.      |View Pix    | |     | Tuesday     | |      |DPaint      | |
  417.      |Run Progs   | |  >  | Wednesday   | |  >   |Calculator  | |
  418.      |            | |     | Thursday    | |      |IconEdit    | |
  419.      |            | |     | Friday      | |      |etc         | |
  420.      |____________|_|     |_____________|_|      |____________|_|
  421.  
  422.     All the action re-settings would be done within the parent ARexx
  423.     program (though I have made little use of this technique within
  424.     Manager itself).
  425.  
  426.                                                                   
  427.     I'm not going to spell out the potential which this holds, but
  428.     believe me, it astonished me when I first used it, and I'm still
  429.     getting more ideas about ways in which I might use it.  The List
  430.     gadget currently in my Manager window is definitely going to assume
  431.     a major role.  Just think of the possibilities when the items of the
  432.     list are read in from a plain text file and the coding for each
  433.     of them can be tailored to do practically any job.
  434.  
  435.     
  436.      Oh, and there are lots more ..... 
  437.     
  438.     .... interesting features of 'varexx', many of which I have used,
  439.     and I'm certain there are also many more which I have still to
  440.     discover.
  441.  
  442.  
  443.      On-going developments of 'varexx' 
  444.     
  445.     While I was writing this, at the beginning of February, 1996, I
  446.     received email from Andrew Cook telling me that version 1.6 of varexx
  447.     had just been posted to aminet.  I down-loaded it, and started using
  448.     it at once. Great.
  449.  
  450.     Andrew also tells me that a 'major rewrite with many new features' is
  451.     in the pipeline.  Great!
  452.  
  453.     
  454.     Hamilton, New Zealand  February, 1996
  455.     
  456.                          ---------------------------
  457.  
  458.  
  459.  
  460.